﻿var doc=fl.getDocumentDOM() || false;
if(doc != false){
var lib = fl.getDocumentDOM().library; //library 对象   
doc.addNewText({left:0, top:0, right:400, bottom:500} ,"this is jsfl"); 
var tx=doc.getTimeline().layers[0].frames[0].elements[0];//选择文本
tx.textType="dynamic";//设置动态文本
tx.name="msg";
doc.selectAll();  

doc.convertToSymbol("movie clip","config","top left") ; //将文本转化为mc元件     
var itemexists = lib.itemExists("config");
if (itemexists == true)
{
   
     lib.selectItem("config");
	 lib.setItemProperty('linkageExportForAS', true);   
     lib.setItemProperty('linkageExportForRS', false);   
     lib.setItemProperty('linkageExportInFirstFrame', true);   
     lib.setItemProperty('linkageClassName', "config");    
     lib.setItemProperty('scalingGrid',  false); 
	 lib.setItemProperty('linkageBaseClass',  "flash.display.Sprite"); 
	 
	 lib.selectNone();
     doc.selectAll(); //清空舞台   
     doc.deleteSelection();
	 alert("文本转换MovieClip完成");
}
}